/*-----------------------------------------------------------------------------
 * eaunits.h
 *
 * Copyright (c) Electronic Arts Inc. All rights reserved.
 * Copyright (c) lijippy@163.com. 2017 - 2018 All rights reserved.
 *---------------------------------------------------------------------------*/


#ifndef INCLUDED_eaunits_h
#define INCLUDED_eaunits_h

#pragma GCC system_header

#include <wabase/base.h>

WA_ONCE()

// Defining common SI unit macros.
//
// The mebibyte is a multiple of the unit byte for digital information. Technically a
// megabyte (MB) is a power of ten, while a mebibyte (MiB) is a power of two,
// appropriate for binary machines. Many Linux distributions use the unit, but it is
// not widely acknowledged within the industry or media.
// Reference: https://en.wikipedia.org/wiki/Mebibyte
//
// Examples:
// 	auto size1 = WA_KILOBYTE(16);
// 	auto size2 = WA_MEGABYTE(128);
// 	auto size3 = WA_MEBIBYTE(8);
// 	auto size4 = WA_GIBIBYTE(8);

// define byte for completeness
#define WA_BYTE(x) x

// Decimal SI units
#define WA_KILOBYTE(x) size_t(x) * 1000
#define WA_MEGABYTE(x) size_t(x) * 1000 * 1000
#define WA_GIGABYTE(x) size_t(x) * 1000 * 1000 * 1000
#define WA_TERABYTE(x) size_t(x) * 1000 * 1000 * 1000 * 1000
#define WA_PETABYTE(x) size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000
#define WA_EXABYTE(x) size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000 * 1000

// Binary SI units
#define WA_KIBIBYTE(x) size_t(x) * 1024 
#define WA_MEBIBYTE(x) size_t(x) * 1024 * 1024
#define WA_GIBIBYTE(x) size_t(x) * 1024 * 1024 * 1024
#define WA_TEBIBYTE(x) size_t(x) * 1024 * 1024 * 1024 * 1024
#define WA_PEBIBYTE(x) size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024
#define WA_EXBIBYTE(x) size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024 * 1024

#endif // INCLUDED_earesult_H




